Add .draftwise/constitution.md — user-editable voice + spec-quality rules#63
Merged
Add .draftwise/constitution.md — user-editable voice + spec-quality rules#63
Conversation
… rules `draftwise init` now writes `.draftwise/constitution.md` on both the brownfield and greenfield paths. Five stable section headings — Voice, Spec language, Edge case discipline, Project conventions, Domain glossary — that every drafting prompt (`new`, `tech`, `tasks`, `scan`, `explain`, greenfield Phase 3) tells the host coding agent to read before drafting and apply by name. `scan` and the greenfield Phase 3 additionally instruct the agent to refine the **Project conventions** section from observed code / chosen stack, replacing the placeholder. This replaces the role that `src/ai/prompts/principles.js` and `src/ai/prompts/spec-quality.js` used to play before the api-mode drop. Those modules injected collaboration + spec-language rules into every system prompt; with synthesis moved entirely into the host coding agent, the rules now live in the user's repo as a markdown file the agent reads on each call. The file is user-editable and version-controlled, so changes are reviewable and travel with the repo. Reader utility at `src/utils/constitution.js` (`readConstitution(cwd)` returns null on ENOENT, propagates other errors); template at `src/utils/constitution-template.js`. Every prompt that references the file says "skip silently if absent" — back-compat for projects that ran `init` before this feature landed. CLAUDE.md and README.md updated end-to-end (key design principles, src/utils list, "What gets installed" tree). CHANGELOG.md `[Unreleased] ### Added` entry documents the rationale and the section structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
draftwise initwrites.draftwise/constitution.mdon both brownfield and greenfield paths. Five stable sections — Voice, Spec language, Edge case discipline, Project conventions, Domain glossary — that every drafting prompt (new,tech,tasks,scan,explain, greenfield Phase 3) instructs the host coding agent to read before drafting and apply by name.src/ai/prompts/principles.js+src/ai/prompts/spec-quality.jsused to play before the api-mode drop. Those modules injected rules into every system prompt; with synthesis moved entirely into the host coding agent, the rules now live in the user's repo as a markdown file the agent reads on each call. Editable, version-controlled, reviewable.scanand greenfield Phase 3 also instruct the agent to refine the Project conventions section from observed code / chosen stack, replacing the placeholder text. Reader atsrc/utils/constitution.jsreturns null on ENOENT — every prompt says "skip silently if absent" so projects that raninitbefore this feature keep working.Test plan
npx vitest run— 228 tests pass (10 new acrosstest/utils/constitution.test.js+test/commands/init.test.js)npm run lintcleannode bin/draftwise.js init --mode=brownfieldin a temp repo confirms.draftwise/constitution.mdis written and contains the five section headingsnode bin/draftwise.js init --mode=greenfield --idea="…"in an empty dir confirms the same